package com.luo.ai.assistant.chat.tool.function;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.i18n.LocaleContextHolder;

import java.time.LocalDateTime;
import java.util.function.Supplier;

/**
 * 工具 - 获取当前时区的时间
 */
public class CurrentDateTime implements Supplier<String> {
    private Logger log = LoggerFactory.getLogger(CurrentDateTime.class);
    /**
     * 工具名称
     */
    public static final String TOOL_NAME = "currentDateTime";

    @Override
    public String get() {
        String curDateTime = LocalDateTime.now().atZone(LocaleContextHolder.getTimeZone().toZoneId()).toString();
        log.debug("[Tool] current date time: {}", curDateTime);
        return curDateTime;
    }
}